<?php
/**
 * @author       Sixe Team
 * @email        info@eee-eee.com
 * @url          http://www.eee-eee.com
 * @copyright    Copyright (C) 2010 - 2019 Sixe Information Technology Limited. All rights reserved.
 * @license      GNU General Public License version 2 or later; see LICENSE.txt
 * @date         2019/10/01 10:00
 */

defined('_JEXEC') or die;
$list = $displayData->list;
$path = $displayData->path;
$active_id = $displayData->active_id;
$default_id = $displayData->default_id;

$app = JFactory::getApplication();

// The menu class is deprecated. Use nav instead
?>
<ul class="nav menu mod-list">
	<?php foreach ($list as $i => &$item) {
		$class = 'item-' . $item->id;

		if ($item->id == $default_id) {
			$class .= ' default';
		}

		if ($item->id == $active_id || ($item->type === 'alias' && $item->params->get('aliasoptions') == $active_id)) {
			$class .= ' current';
		}

		if (in_array($item->id, $path)) {
			$class .= ' active';
		} elseif ($item->type === 'alias') {
			$aliasToId = $item->params->get('aliasoptions');

			if (count($path) > 0 && $aliasToId == $path[count($path) - 1]) {
				$class .= ' active';
			} elseif (in_array($aliasToId, $path)) {
				$class .= ' alias-parent-active';
			}
		}

		if ($item->type === 'separator') {
			$class .= ' divider';
		}

		if ($item->deeper) {
			$class .= ' deeper';
		}

		if ($item->parent) {
			$class .= ' parent';
		}

		echo '<li class="' . $class . '">';

		switch ($item->type) :
			case 'separator':
			case 'component':
			case 'heading':
			case 'url':
				//require JModuleHelper::getLayoutPath('mod_menu', 'default_' . $item->type);
				echo $this->sublayout($item->type, array('item' => $item));
				break;

			default:
				echo $this->sublayout('url', array('item' => $item));
				break;
		endswitch;
		//echo ($view_count[$item->query['view']]) ? '<span class="total">'.$view_count[$item->query['view']].'</span>' :'';
		// The next item is deeper.
		if ($item->deeper) {
			echo '<ul class="nav-child unstyled small">';
		} // The next item is shallower.
		elseif ($item->shallower) {
			echo '</li>';
			echo str_repeat('</ul></li>', $item->level_diff);
		} // The next item is on the same level.
		else {
			echo '</li>';
		}
	}
	?>

</ul>
